Skip to content

feat(models): add data_visualization Block Kit block#1899

Draft
zimeg wants to merge 1 commit into
mainfrom
chore/block-kit-data-visualization
Draft

feat(models): add data_visualization Block Kit block#1899
zimeg wants to merge 1 commit into
mainfrom
chore/block-kit-data-visualization

Conversation

@zimeg

@zimeg zimeg commented Jun 26, 2026

Copy link
Copy Markdown
Member

Summary

Adds the net-new data_visualization Block Kit block to the SDK's block models. The block renders data as a pie, bar, area, or line chart.

  • New DataVisualizationBlock (type: "data_visualization") in slack_sdk/models/blocks/blocks.py with title (required, max 50 chars), chart (required), and optional block_id.
  • The chart object is accepted as a dict (consistent with how TableBlock/DataTableBlock model their nested structures): a pie chart carries segments; bar/area/line carry series plus axis_config.
  • Validation: title presence + length (<=50), chart presence, and chart.type membership in {pie, bar, area, line}.
  • Registered in Block.parse() and exported from slack_sdk/models/blocks/__init__.py (DataVisualizationBlock in both the import and __all__).
  • Tests in tests/slack_sdk/models/test_blocks.py mirroring the existing DataTableBlock coverage (doc example, bar chart with block_id, line chart with negatives, required-arg and validation cases).

Docs

https://docs.slack.dev/reference/block-kit/blocks/data-visualization-block

Validation steps run

  • black --line-length 125 on the touched files: no changes (already compliant).
  • pytest tests/slack_sdk/models/test_blocks.py: 97 passed (7 new DataVisualizationBlock cases included).
  • mypy slack_sdk/models/blocks/blocks.py: success, no issues.
  • Smoke test: construct + to_dict() round-trip and Block.parse() resolve to DataVisualizationBlock.

No changeset added: this repo does not use .changeset/ (version is managed via slack_sdk/version.py).

Co-Authored-By: Claude svc-devxp-claude@slack-corp.com

Add DataVisualizationBlock supporting pie, bar, area, and line charts,
including title length and chart type validation, parse() registration,
package exports, and tests mirroring existing block coverage.

Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
@codecov

codecov Bot commented Jun 26, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.21429% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 84.17%. Comparing base (e23b181) to head (e1e9aed).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
slack_sdk/models/blocks/blocks.py 98.21% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1899      +/-   ##
==========================================
+ Coverage   84.14%   84.17%   +0.02%     
==========================================
  Files         117      117              
  Lines       13356    13412      +56     
==========================================
+ Hits        11238    11289      +51     
- Misses       2118     2123       +5     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant